package com.xinyue.gateway.beans;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Scope;
import com.xinyue.gateway.config.GateServerConfig;
import com.xinyue.gateway.server.handler.GameIdleStateHandler;

@Configuration
public class GameBeans {

    @Autowired
    private GateServerConfig gateServerConfig;
    @Bean
    @Scope(scopeName = "prototype")
    public GameIdleStateHandler newChannelHeartbeatHandler() {
        return new GameIdleStateHandler(gateServerConfig.getReaderIdleTimeSeconds(), gateServerConfig.getWriterIdleTimeSeconds(), gateServerConfig.getAllIdleTimeSeconds());
    }

}
